package com.itheima.controller.backend.security;

import com.itheima.common.entity.Result;
import com.itheima.service.ValidateCodeService;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

@RestController
@RequestMapping("/validatecode")
@Slf4j
public class ValidateCodeController {
    @Autowired
    private ValidateCodeService validateCodeService;

    /**
     * 体检预约发送验证码
     * @param telephone
     * @return
     */
    @PostMapping("/send4Order")
    public Result sendMessageCode(String telephone){
        log.info("体检预约发送验证码:{}",telephone);
        String code=validateCodeService.sendMessageCode(telephone);
        log.info("验证码：{}",code);
        return new Result(true,"",code);
    }

}
